<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>狼窝窝问答页面</title>
    <meta name="viewport"
          content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui,viewport-fit=cover">
    <meta name="copyright" content="Copyright (c) 2006-2018 Luowogwo.">
    <meta name="format-detection" content="telephone=no,address=no">
    <meta name="referrer" content="always">
    <meta name="apple-mobile-web-app-capable" content="no">
    <meta name="apple-mobile-web-app-status-bar-style" content="no">
    <link href="/css/question/mobile+css+head_mobile+css+ui.css"
          rel="stylesheet" type="text/css">
    <link href="/css/question/new_ask2016.css" rel="stylesheet" type="text/css">

    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {
            //当前页
            var currentPage = 1;
            //总页数
            var pages;
            //声明一个用于存储问题的容器
            var questionsArr = [];

            function query() {
                //查询提问的问题列表
                $.get(baseUrl + "/questions", {currentPage: currentPage}, function (data) {
                    //把第二个数组合并第一个数组中
                    $.merge(questionsArr, data.list);
                    var json = {
                        list: questionsArr
                    };
                    //渲染数据
                    $("#question").renderValues(json, {
                        //点击头像跳转个人页面
                        getUserHref: getHref,
                        //点击跳转问题回复页面
                        getHref: function (item, value) {
                            var href = $(item).data("href");
                            $(item).attr('href', href + value);
                        }
                    });
                    //获取总页数
                    pages = data.pages;
                });
                currentPage++;
            }

            query();//先查询一次,页面才有数据

            //绑定更多问题事件
            $("#moreQuestion").click(function () {
                //如果是小于总页数就发送请求
                if (currentPage <= pages) {
                    query();
                } else {
                    $(document).dialog({
                        type: 'notice',
                        content: '<span class="info-text">没有问题!</span>',
                        autoClose: 1500
                    });
                }
            });


        })
    </script>
</head>

<body>
<div id="pos38"></div>
<header class="MfwHead ">
    <div class="LBtn">
        <a class="btn back" href="/index.html" id="_j_top_history_back">
            <span><i class="fa fa-chevron-left fa-2x"></i></span>
        </a>
    </div>
    <div class="CBtn">
        <h1>狼窝窝问答</h1>
    </div>
    <div class="RBtn">
    </div>
</header>
<div>
    <img src="/upload/20190602210817.jpg" style="width: 100%">
</div>


<section class="ans-list a-list">
    <ul class="_j_pager_box">
        <div id="question">
            <div render-loop="list">
                <li>
                    <a data-href="/answer.html?id=" render-fun="getHref" render-key="list.id">
                        <h2 render-html="list.title"></h2>
                    </a>
                    <div class="clearfix">
                        <div class="rol">
                            <p>
                                <a data-url="/userProfiles.html?id=" render-key="list.questionUser.id"
                                   render-fun="getUserHref">
                                    <img style="border-radius: 30px" render-src="list.questionUser.headImgUrl"
                                         width="40px">
                                    <span render-html="list.questionUser.nickName"></span>
                                </a>
                            </p>
                        </div>
                        <br>
                        <div class="ans-nr">
                            <a data-href="/answer.html?id=" render-fun="getHref"
                               render-key="list.id">
                                <div class="clearfix">
                                    <div class="pic">
                                        <img render-src="list.questionImgUrl" width="80px">
                                        <h2></h2>
                                    </div>
                                    <p render-html="list.questionContent"></p>
                                </div>
                            </a>
                            <div class="clearfix">
                                <span class="fl-l" render-html="list.questionPlace"></span>
                                <span class="fl-r">
                                            <b render-html="list.visitCount"></b>浏览
                                            <b render-html="list.answerCount"></b>回答
                                        </span>
                            </div>
                        </div>
                    </div>
                </li>
            </div>
        </div>
    </ul>
    <div style="margin-bottom: 65px;" id="moreQuestion">
        <a class="more-list _j_add_more_button">更多问题</a>
    </div>
</section>

<section class="askfoot">
    <a href="/mine/quiz.html" class="btn-que" data-cs-p="show_publish"><i></i>
        我要提问
    </a>
</section>
</body>
</html>